import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '创建日期',
    align:"center",
    dataIndex: 'createTime',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },
   {
    title: '产品名称',
    align:"center",
    dataIndex: 'productName'
   },
   {
    title: '产品编码',
    align:"center",
    dataIndex: 'productNo'
   },
   {
    title: '平台',
    align:"center",
    dataIndex: 'platform_dictText'
   },
   {
    title: '产品链接',
    align:"center",
    dataIndex: 'url'
   },
   {
    title: '新品',
    align:"center",
    dataIndex: 'isNew_dictText'
   },
   {
    title: '大促价',
    align:"center",
    dataIndex: 'promotionalPrice'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "产品名称",
      field: 'productName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "产品编号",
      field: 'productNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "平台",
      field: 'platform',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"ecommerce_platform"
      },
      //colProps: {span: 6},
 	},
	{
      label: "新品",
      field: 'isNew',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"yn"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '产品名称',
    field: 'productName',
    component: 'Input',
  },
  {
    label: '产品编号',
    field: 'productNo',
    component: 'Input',
  },
  {
    label: '平台',
    field: 'platform',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"ecommerce_platform"
     },
  },
  {
    label: '产品链接',
    field: 'url',
    component: 'Input',
  },
  {
    label: '新品',
    field: 'isNew',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"yn"
     },
  },
  {
    label: '大促价',
    field: 'promotionalPrice',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  createTime: {title: '创建日期',order: 0,view: 'date', type: 'string',},
  productName: {title: '产品名称',order: 1,view: 'text', type: 'string',},
  productNo: {title: '产品编号',order: 2,view: 'text', type: 'string',},
  platform: {title: '平台',order: 3,view: 'list', type: 'string',dictCode: 'ecommerce_platform',},
  url: {title: '产品链接',order: 4,view: 'text', type: 'string',},
  isNew: {title: '新品',order: 5,view: 'list', type: 'string',dictCode: 'yn',},
  promotionalPrice: {title: '大促价',order: 6,view: 'text', type: 'string',},
  remark: {title: '备注',order: 7,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}